package com.yong.sbd.biz.mybatis.service.impl;

import com.yong.sbd.biz.mybatis.entity.SysUser;
import com.yong.sbd.biz.mybatis.mapper.UserRoleMapper;
import com.yong.sbd.biz.mybatis.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户角色服务实现类
 *
 * @author Kang Yong
 * @date 2025/10/24
 * @since 1.0.0
 */
@Service
public class UserRoleServiceImpl implements UserRoleService {

    @Autowired
    private UserRoleMapper userRoleMapper;

    @Override
    public SysUser getUserWithRoles(Long userId) {
        return userRoleMapper.selectUserWithRoles(userId);
    }

    @Override
    public List<SysUser> getAllUsersWithRoles() {
        return userRoleMapper.selectAllUsersWithRoles();
    }

    @Override
    public List<SysUser> getUsersByRoleId(Long roleId) {
        return userRoleMapper.selectUsersByRoleId(roleId);
    }

    @Override
    public List<SysUser> getUsersByRoleCode(String roleCode) {
        return userRoleMapper.selectUsersByRoleCode(roleCode);
    }
}